/*
 * @Author: wangke
 * @Date: 2025-07-20 13:35:31
 * @LastEditors: wangke
 * @LastEditTime: 2025-07-20 23:35:32
 * 
 */
#include "App_Screen.h"
#include <SPI.h>
#include <Arduino.h>
#include "Common.h"

unsigned int page = 0;
unsigned int autoplay = 0;

const int SS0_PIN = 10;  // 片选引脚
const int TFT_DC = 12;  // 片选引脚
const int SCK_PIN = 14; // 时钟线引脚
const int MOSI_PIN = 13; // 主设备数据输出引脚
const int MISO_PIN = 42; // 主设备数据输入引脚
const int TFT_RST = 11;

#define TFT_RST_0   digitalWrite(TFT_RST, LOW);
#define TFT_RST_1   digitalWrite(TFT_RST, HIGH);

#define TFT_DC_0   digitalWrite(TFT_DC, LOW);
#define TFT_DC_1   digitalWrite(TFT_DC, HIGH);

SPIClass SPI1;

void TFT_SPI_INIT()
{
    pinMode(SS0_PIN, OUTPUT);
    pinMode(TFT_RST, OUTPUT);
    pinMode(TFT_DC, OUTPUT);
    digitalWrite(SS0_PIN, HIGH);
    digitalWrite(TFT_RST, HIGH);

    SPI1.begin(SCK_PIN, MISO_PIN, MOSI_PIN, SS0_PIN);
    SPI1.beginTransaction(SPISettings(1125000, SPI_MSBFIRST, SPI_MODE0));
}
void SPI_SendByte(unsigned char byte)
{
	SPI1.transfer(byte);
}

void TFT_SEND_CMD(unsigned char o_command)
{
    digitalWrite(SS0_PIN, LOW);
    TFT_DC_0;
    SPI_SendByte(o_command);
    digitalWrite(SS0_PIN, HIGH);
}

void TFT_SEND_DATA(unsigned char o_data)
{ 
	digitalWrite(SS0_PIN, LOW);
	TFT_DC_1;
	SPI_SendByte(o_data);
	digitalWrite(SS0_PIN, HIGH);
}

void TFT_SET_ADD(unsigned short int X,unsigned short int Y,unsigned short int X_END,unsigned short int Y_END)
{	
	TFT_SEND_CMD(0x2A);     //窗口地址横向                   
    TFT_SEND_DATA(X>>8);     
    TFT_SEND_DATA(X);		//start column
	TFT_SEND_DATA(X_END>>8);     
    TFT_SEND_DATA(X_END);	//start column
	TFT_SEND_CMD(0x2B);     //窗口地址纵向                   
    TFT_SEND_DATA(Y>>8);     
    TFT_SEND_DATA(Y);		//start row
    TFT_SEND_DATA(Y_END>>8);     
    TFT_SEND_DATA(Y_END);		//start row
    TFT_SEND_CMD(0x2C);     //写入数据   
}
void TFT_init(void)	//GC9A01
{
	TFT_RST_0;//复位 
	delay(100); 
	TFT_RST_1; 
	delay(100); 


	  
    TFT_SEND_CMD(0xEF); 		//使用指令2
    TFT_SEND_CMD(0xEB); 		//
    TFT_SEND_DATA(0x14);

    TFT_SEND_CMD(0xFE); 		//使用指令1
    TFT_SEND_CMD(0xEF); 		//使用指令2  设置inter指令可用完成，复位之后才可关闭

    TFT_SEND_CMD(0xEB); 
    TFT_SEND_DATA(0x14); 

    TFT_SEND_CMD(0x84); 
    TFT_SEND_DATA(0x40); 
    TFT_SEND_CMD(0x85); 
    TFT_SEND_DATA(0xFF); 
    TFT_SEND_CMD(0x86); 
    TFT_SEND_DATA(0xFF); 
    TFT_SEND_CMD(0x87); 
    TFT_SEND_DATA(0xFF); 
    TFT_SEND_CMD(0x88); 
    TFT_SEND_DATA(0x0A); 
    TFT_SEND_CMD(0x89); 
    TFT_SEND_DATA(0x21);

    TFT_SEND_CMD(0x8A); 
    TFT_SEND_DATA(0x00);

    TFT_SEND_CMD(0x8B); 
    TFT_SEND_DATA(0x80);

    TFT_SEND_CMD(0x8C); 
    TFT_SEND_DATA(0x01);

    TFT_SEND_CMD(0x8D); 
    TFT_SEND_DATA(0x01);

    TFT_SEND_CMD(0x8E); 
    TFT_SEND_DATA(0xFF);

    TFT_SEND_CMD(0x8F); 
    TFT_SEND_DATA(0xFF);

    TFT_SEND_CMD(0xB6); 	//外部指令  显示功能控制
    TFT_SEND_DATA(0x00); 		//扫描方向控制S1-S360 G1-32
    TFT_SEND_DATA(0x20); 		

    TFT_SEND_CMD(0x36); 	//调整指令 存储控制 Memory Access Control
    TFT_SEND_DATA(0x08); 		//MY MX MV ML BGR MH X X

    TFT_SEND_CMD(0x3A); 	//调整指令 	Pixel Format Set
    TFT_SEND_DATA(0x05); 			//16bit MCU数据模式

    TFT_SEND_CMD(0x90); 	//xxx
    TFT_SEND_DATA(0x08); 
    TFT_SEND_DATA(0x08); 
    TFT_SEND_DATA(0x08); 
    TFT_SEND_DATA(0x08);

    TFT_SEND_CMD(0xBD); 	//XXX
    TFT_SEND_DATA(0x06);

    TFT_SEND_CMD(0xBC); 	//XXX
    TFT_SEND_DATA(0x00); 

    TFT_SEND_CMD(0xFF); 	//XXX	
    TFT_SEND_DATA(0x60); 
    TFT_SEND_DATA(0x01); 
    TFT_SEND_DATA(0x04);

    TFT_SEND_CMD(0xC3); 	//	Vreg1a voltage Control
    TFT_SEND_DATA(0x13);

    TFT_SEND_CMD(0xC4); 	// Vreg1b voltage Control
    TFT_SEND_DATA(0x13);

    TFT_SEND_CMD(0xC9); 	//Vreg2a voltage Control
    TFT_SEND_DATA(0x22);

    TFT_SEND_CMD(0xBE); 	//XXX
    TFT_SEND_DATA(0x11); 

    TFT_SEND_CMD(0xE1); 	//XXX
    TFT_SEND_DATA(0x10);
    TFT_SEND_DATA(0x0E); 

    TFT_SEND_CMD(0xDF); 	//XXX
    TFT_SEND_DATA(0x21); 
    TFT_SEND_DATA(0x0c); 
    TFT_SEND_DATA(0x02); 

    TFT_SEND_CMD(0xF0); 	//GAMMA1
    TFT_SEND_DATA(0x45); 
    TFT_SEND_DATA(0x09); 
    TFT_SEND_DATA(0x08); 
    TFT_SEND_DATA(0x08); 
    TFT_SEND_DATA(0x26); 
    TFT_SEND_DATA(0x2A); 

    TFT_SEND_CMD(0xF1); 	//GAMMA2
    TFT_SEND_DATA(0x43); 
    TFT_SEND_DATA(0x70); 
    TFT_SEND_DATA(0x72); 
    TFT_SEND_DATA(0x36); 
    TFT_SEND_DATA(0x37); 
    TFT_SEND_DATA(0x6F); 

    TFT_SEND_CMD(0xF2); 	//GAMMA3
    TFT_SEND_DATA(0x45); 
    TFT_SEND_DATA(0x09); 
    TFT_SEND_DATA(0x08); 
    TFT_SEND_DATA(0x08); 
    TFT_SEND_DATA(0x26); 
    TFT_SEND_DATA(0x2A); 

    TFT_SEND_CMD(0xF3); 	////GAMMA4
    TFT_SEND_DATA(0x43); 
    TFT_SEND_DATA(0x70); 
    TFT_SEND_DATA(0x72); 
    TFT_SEND_DATA(0x36); 
    TFT_SEND_DATA(0x37); 
    TFT_SEND_DATA(0x6F);

    TFT_SEND_CMD(0xED); 	//XXX
    TFT_SEND_DATA(0x1B); 
    TFT_SEND_DATA(0x0B);

    TFT_SEND_CMD(0xAE); 	//XXX
    TFT_SEND_DATA(0x77);

    TFT_SEND_CMD(0xCD); 	//XXX
    TFT_SEND_DATA(0x63);

    TFT_SEND_CMD(0x70); 
    TFT_SEND_DATA(0x07); 
    TFT_SEND_DATA(0x07); 
    TFT_SEND_DATA(0x04); 
    TFT_SEND_DATA(0x0E); 
    TFT_SEND_DATA(0x0F); 
    TFT_SEND_DATA(0x09); 
    TFT_SEND_DATA(0x07); 
    TFT_SEND_DATA(0x08); 
    TFT_SEND_DATA(0x03); 

    TFT_SEND_CMD(0xE8); 	//Frame Rate
    TFT_SEND_DATA(0x34);

    TFT_SEND_CMD(0x62); 	//XXX
    TFT_SEND_DATA(0x18); 
    TFT_SEND_DATA(0x0D); 
    TFT_SEND_DATA(0x71); 
    TFT_SEND_DATA(0xED); 
    TFT_SEND_DATA(0x70); 
    TFT_SEND_DATA(0x70); 
    TFT_SEND_DATA(0x18); 
    TFT_SEND_DATA(0x0F); 
    TFT_SEND_DATA(0x71); 
    TFT_SEND_DATA(0xEF); 
    TFT_SEND_DATA(0x70); 
    TFT_SEND_DATA(0x70); 

    TFT_SEND_CMD(0x63); 	//XXX
    TFT_SEND_DATA(0x18); 
    TFT_SEND_DATA(0x11); 
    TFT_SEND_DATA(0x71); 
    TFT_SEND_DATA(0xF1); 
    TFT_SEND_DATA(0x70); 
    TFT_SEND_DATA(0x70); 
    TFT_SEND_DATA(0x18); 
    TFT_SEND_DATA(0x13); 
    TFT_SEND_DATA(0x71); 
    TFT_SEND_DATA(0xF3); 
    TFT_SEND_DATA(0x70); 
    TFT_SEND_DATA(0x70); 

    TFT_SEND_CMD(0x64); 	//XXX
    TFT_SEND_DATA(0x28); 
    TFT_SEND_DATA(0x29); 
    TFT_SEND_DATA(0xF1); 
    TFT_SEND_DATA(0x01); 
    TFT_SEND_DATA(0xF1); 
    TFT_SEND_DATA(0x00); 
    TFT_SEND_DATA(0x07);

    TFT_SEND_CMD(0x66); 	//XXX
    TFT_SEND_DATA(0x3C); 
    TFT_SEND_DATA(0x00); 
    TFT_SEND_DATA(0xCD); 
    TFT_SEND_DATA(0x67); 
    TFT_SEND_DATA(0x45); 
    TFT_SEND_DATA(0x45); 
    TFT_SEND_DATA(0x10); 
    TFT_SEND_DATA(0x00); 
    TFT_SEND_DATA(0x00); 
    TFT_SEND_DATA(0x00); 

    TFT_SEND_CMD(0x67); 	//XXX
    TFT_SEND_DATA(0x00); 
    TFT_SEND_DATA(0x3C); 
    TFT_SEND_DATA(0x00); 
    TFT_SEND_DATA(0x00); 
    TFT_SEND_DATA(0x00); 
    TFT_SEND_DATA(0x01); 
    TFT_SEND_DATA(0x54); 
    TFT_SEND_DATA(0x10); 
    TFT_SEND_DATA(0x32); 
    TFT_SEND_DATA(0x98);

    TFT_SEND_CMD(0x74); 	//XXX
    TFT_SEND_DATA(0x10); 
    TFT_SEND_DATA(0x85); 
    TFT_SEND_DATA(0x80); 
    TFT_SEND_DATA(0x00); 
    TFT_SEND_DATA(0x00); 
    TFT_SEND_DATA(0x4E); 
    TFT_SEND_DATA(0x00);

    TFT_SEND_CMD(0x98); 		//XXX
    TFT_SEND_DATA(0x3e); 
    TFT_SEND_DATA(0x07); 

    TFT_SEND_CMD(0x34); 	//Tearing Effect Line Off
    TFT_SEND_CMD(0x21); 	//Display Inversion ON
    TFT_SEND_CMD(0x11); 	//唤醒
    //TFT_SEND_CMD(0x38);	//Idle Mode OFF
    delay(120); 
    TFT_SEND_CMD(0x29); 	//显示开
    delay(20);
}

void TFT_init2(void)	//GC9A01
{
	  TFT_SEND_CMD(0xEF); 		//使用指令2
	  TFT_SEND_CMD(0xEB); 		//
	  TFT_SEND_DATA(0x14);
	  
	  TFT_SEND_CMD(0xFE); 		//使用指令1
	  TFT_SEND_CMD(0xEF); 		//使用指令2  设置inter指令可用完成，复位之后才可关闭
	  
	  TFT_SEND_CMD(0xEB); 
	  TFT_SEND_DATA(0x14); 
	  
	  TFT_SEND_CMD(0x84); 
	  TFT_SEND_DATA(0x40); 
	  TFT_SEND_CMD(0x85); 
	  TFT_SEND_DATA(0xFF); 
	  TFT_SEND_CMD(0x86); 
	  TFT_SEND_DATA(0xFF); 
	  TFT_SEND_CMD(0x87); 
	  TFT_SEND_DATA(0xFF); 
	  TFT_SEND_CMD(0x88); 
	  TFT_SEND_DATA(0x0A); 
	  TFT_SEND_CMD(0x89); 
	  TFT_SEND_DATA(0x21);
	  
	  TFT_SEND_CMD(0x8A); 
	  TFT_SEND_DATA(0x00);
	  
	  TFT_SEND_CMD(0x8B); 
	  TFT_SEND_DATA(0x80);
	  
	  TFT_SEND_CMD(0x8C); 
	  TFT_SEND_DATA(0x01);
	  
	  TFT_SEND_CMD(0x8D); 
	  TFT_SEND_DATA(0x01);
	  
	  TFT_SEND_CMD(0x8E); 
	  TFT_SEND_DATA(0xFF);
	  
	  TFT_SEND_CMD(0x8F); 
	  TFT_SEND_DATA(0xFF);
	  
	  TFT_SEND_CMD(0xB6); 	//外部指令  显示功能控制
	  TFT_SEND_DATA(0x00); 		//扫描方向控制S1-S360 G1-32
	  TFT_SEND_DATA(0x20); 		
	  
	  TFT_SEND_CMD(0x36); 	//调整指令 存储控制 Memory Access Control
	  TFT_SEND_DATA(0x08); 		//MY MX MV ML BGR MH X X
	  
	  TFT_SEND_CMD(0x3A); 	//调整指令 	Pixel Format Set
	  TFT_SEND_DATA(0x05); 			//16bit MCU数据模式
	  
	  TFT_SEND_CMD(0x90); 	//xxx
	  TFT_SEND_DATA(0x08); 
	  TFT_SEND_DATA(0x08); 
	  TFT_SEND_DATA(0x08); 
	  TFT_SEND_DATA(0x08);
	  
	  TFT_SEND_CMD(0xBD); 	//XXX
	  TFT_SEND_DATA(0x06);
	  
	  TFT_SEND_CMD(0xBC); 	//XXX
	  TFT_SEND_DATA(0x00); 
	  
	  TFT_SEND_CMD(0xFF); 	//XXX	
	  TFT_SEND_DATA(0x60); 
	  TFT_SEND_DATA(0x01); 
	  TFT_SEND_DATA(0x04);
	  
	  TFT_SEND_CMD(0xC3); 	//	Vreg1a voltage Control
	  TFT_SEND_DATA(0x13);
	  
	  TFT_SEND_CMD(0xC4); 	// Vreg1b voltage Control
	  TFT_SEND_DATA(0x13);
	  
	  TFT_SEND_CMD(0xC9); 	//Vreg2a voltage Control
	  TFT_SEND_DATA(0x22);
	  
	  TFT_SEND_CMD(0xBE); 	//XXX
	  TFT_SEND_DATA(0x11); 
	  
	  TFT_SEND_CMD(0xE1); 	//XXX
	  TFT_SEND_DATA(0x10);
	  TFT_SEND_DATA(0x0E); 
	  
	  TFT_SEND_CMD(0xDF); 	//XXX
	  TFT_SEND_DATA(0x21); 
	  TFT_SEND_DATA(0x0c); 
	  TFT_SEND_DATA(0x02); 
	  
	  TFT_SEND_CMD(0xF0); 	//GAMMA1
	  TFT_SEND_DATA(0x45); 
	  TFT_SEND_DATA(0x09); 
	  TFT_SEND_DATA(0x08); 
	  TFT_SEND_DATA(0x08); 
	  TFT_SEND_DATA(0x26); 
	  TFT_SEND_DATA(0x2A); 
	  
	  TFT_SEND_CMD(0xF1); 	//GAMMA2
	  TFT_SEND_DATA(0x43); 
	  TFT_SEND_DATA(0x70); 
	  TFT_SEND_DATA(0x72); 
	  TFT_SEND_DATA(0x36); 
	  TFT_SEND_DATA(0x37); 
	  TFT_SEND_DATA(0x6F); 
	  
	  TFT_SEND_CMD(0xF2); 	//GAMMA3
	  TFT_SEND_DATA(0x45); 
	  TFT_SEND_DATA(0x09); 
	  TFT_SEND_DATA(0x08); 
	  TFT_SEND_DATA(0x08); 
	  TFT_SEND_DATA(0x26); 
	  TFT_SEND_DATA(0x2A); 
	  
	  TFT_SEND_CMD(0xF3); 	////GAMMA4
	  TFT_SEND_DATA(0x43); 
	  TFT_SEND_DATA(0x70); 
	  TFT_SEND_DATA(0x72); 
	  TFT_SEND_DATA(0x36); 
	  TFT_SEND_DATA(0x37); 
	  TFT_SEND_DATA(0x6F);
	  
	  TFT_SEND_CMD(0xED); 	//XXX
	  TFT_SEND_DATA(0x1B); 
	  TFT_SEND_DATA(0x0B);
	  
	  TFT_SEND_CMD(0xAE); 	//XXX
	  TFT_SEND_DATA(0x77);
	  
	  TFT_SEND_CMD(0xCD); 	//XXX
	  TFT_SEND_DATA(0x63);
	  
	  TFT_SEND_CMD(0x70); 
	  TFT_SEND_DATA(0x07); 
	  TFT_SEND_DATA(0x07); 
	  TFT_SEND_DATA(0x04); 
	  TFT_SEND_DATA(0x0E); 
	  TFT_SEND_DATA(0x0F); 
	  TFT_SEND_DATA(0x09); 
	  TFT_SEND_DATA(0x07); 
	  TFT_SEND_DATA(0x08); 
	  TFT_SEND_DATA(0x03); 
	  
	  TFT_SEND_CMD(0xE8); 	//Frame Rate
	  TFT_SEND_DATA(0x34);
	  
	  TFT_SEND_CMD(0x62); 	//XXX
	  TFT_SEND_DATA(0x18); 
	  TFT_SEND_DATA(0x0D); 
	  TFT_SEND_DATA(0x71); 
	  TFT_SEND_DATA(0xED); 
	  TFT_SEND_DATA(0x70); 
	  TFT_SEND_DATA(0x70); 
	  TFT_SEND_DATA(0x18); 
	  TFT_SEND_DATA(0x0F); 
	  TFT_SEND_DATA(0x71); 
	  TFT_SEND_DATA(0xEF); 
	  TFT_SEND_DATA(0x70); 
	  TFT_SEND_DATA(0x70); 
	  
	  TFT_SEND_CMD(0x63); 	//XXX
	  TFT_SEND_DATA(0x18); 
	  TFT_SEND_DATA(0x11); 
	  TFT_SEND_DATA(0x71); 
	  TFT_SEND_DATA(0xF1); 
	  TFT_SEND_DATA(0x70); 
	  TFT_SEND_DATA(0x70); 
	  TFT_SEND_DATA(0x18); 
	  TFT_SEND_DATA(0x13); 
	  TFT_SEND_DATA(0x71); 
	  TFT_SEND_DATA(0xF3); 
	  TFT_SEND_DATA(0x70); 
	  TFT_SEND_DATA(0x70); 
	  
	  TFT_SEND_CMD(0x64); 	//XXX
	  TFT_SEND_DATA(0x28); 
	  TFT_SEND_DATA(0x29); 
	  TFT_SEND_DATA(0xF1); 
	  TFT_SEND_DATA(0x01); 
	  TFT_SEND_DATA(0xF1); 
	  TFT_SEND_DATA(0x00); 
	  TFT_SEND_DATA(0x07);
	  
	  TFT_SEND_CMD(0x66); 	//XXX
	  TFT_SEND_DATA(0x3C); 
	  TFT_SEND_DATA(0x00); 
	  TFT_SEND_DATA(0xCD); 
	  TFT_SEND_DATA(0x67); 
	  TFT_SEND_DATA(0x45); 
	  TFT_SEND_DATA(0x45); 
	  TFT_SEND_DATA(0x10); 
	  TFT_SEND_DATA(0x00); 
	  TFT_SEND_DATA(0x00); 
	  TFT_SEND_DATA(0x00); 
	  
	  TFT_SEND_CMD(0x67); 	//XXX
	  TFT_SEND_DATA(0x00); 
	  TFT_SEND_DATA(0x3C); 
	  TFT_SEND_DATA(0x00); 
	  TFT_SEND_DATA(0x00); 
	  TFT_SEND_DATA(0x00); 
	  TFT_SEND_DATA(0x01); 
	  TFT_SEND_DATA(0x54); 
	  TFT_SEND_DATA(0x10); 
	  TFT_SEND_DATA(0x32); 
	  TFT_SEND_DATA(0x98);
	  
	  TFT_SEND_CMD(0x74); 	//XXX
	  TFT_SEND_DATA(0x10); 
	  TFT_SEND_DATA(0x85); 
	  TFT_SEND_DATA(0x80); 
	  TFT_SEND_DATA(0x00); 
	  TFT_SEND_DATA(0x00); 
	  TFT_SEND_DATA(0x4E); 
	  TFT_SEND_DATA(0x00);
	  
	  TFT_SEND_CMD(0x98); 		//XXX
	  TFT_SEND_DATA(0x3e); 
	  TFT_SEND_DATA(0x07); 
	  
	  TFT_SEND_CMD(0x34); 	//Tearing Effect Line Off
	  TFT_SEND_CMD(0x21); 	//Display Inversion ON

	//TFT_SEND_CMD(0x11); 	//唤醒
	  //TFT_SEND_CMD(0x29); 	//显示开
}

void TFT_clear()
{
    TFT_SET_ADD(0,0,TFT_COLUMN_NUMBER-1,TFT_LINE_NUMBER-1);
    for(int i=0;i<76800;i++)             //Line loop
    { 
        TFT_SEND_DATA(0xF);
        TFT_SEND_DATA(0xF);
    }
}

void TFT_full(unsigned int color)
{
unsigned long Line,column;
    TFT_SET_ADD(0,0,TFT_COLUMN_NUMBER-1,TFT_LINE_NUMBER-1);
for(Line=0;Line<TFT_LINE_NUMBER;Line++)             //Line loop
    { 
        
    for(column=0;column<TFT_COLUMN_NUMBER;column++)	//column loop
        {
            TFT_SEND_DATA(color>>8);
            TFT_SEND_DATA(color);
        }
    }
}

void TFT_Fill(uint16_t x,uint16_t y,uint16_t length,uint16_t width,unsigned int color)
{
	uint16_t i,j;
	TFT_SET_ADD(x,y,x+length-1,y+width-1);
	for(i=0;i<length;i++)
	{
		for(j=0;j<width;j++)
		{
			TFT_SEND_DATA(color>>8);
			TFT_SEND_DATA(color);
		}
	}			
}

void Picture_display(uint16_t x,uint16_t y,uint16_t length,uint16_t width,const unsigned char *ptr_pic)
{
	uint16_t i,j;
	TFT_SET_ADD(x,y,x+length-1,y+width-1);
	for(i=0;i<length;i++)
	{
		for(j=0;j<width;j++)
		{
      TFT_SEND_DATA(*ptr_pic++);
			TFT_SEND_DATA(*ptr_pic++);
		}
	}			
}

void TFT_Page_bar()
{
	int col = TFT_COLUMN_NUMBER;
	int row = TFT_LINE_NUMBER;
	
	int c = 0;
	int r = 0;

	int c2 = 0;
	//int r2 = 0;

	int ex = 0;

	for(c=0;c<col;c++)
	{
		for(r=0;r<row;r++)
		{
			c2 = (int)(c/30);
			//r2 = (int)(r/30);
			
			ex = c2 % 8;
			//ex = r2 % 8;
			
			if(ex == 0){
				TFT_SEND_DATA(0xFF);
				TFT_SEND_DATA(0xFF);
			}else if(ex == 1){
				TFT_SEND_DATA(0x00);
				TFT_SEND_DATA(0x00);
			}else if(ex == 2){
				TFT_SEND_DATA(0x00);
				TFT_SEND_DATA(0x1F);
			}else if(ex == 3){
				TFT_SEND_DATA(0xF8);
				TFT_SEND_DATA(0x1F);
			}else if(ex == 4){
				TFT_SEND_DATA(0xFF);
				TFT_SEND_DATA(0xE0);
			}else if(ex == 5){
				TFT_SEND_DATA(0x07);
				TFT_SEND_DATA(0xFF);
			}else if(ex == 6){
				TFT_SEND_DATA(0xF8);
				TFT_SEND_DATA(0x00);
			}else if(ex == 7){
				TFT_SEND_DATA(0x07);
				TFT_SEND_DATA(0xE0);
			}
			//delay(10);
		}
	}
}

void TFT_Page_border()
{
	int col = TFT_COLUMN_NUMBER;
	int row = TFT_LINE_NUMBER;
	
	int c, r;

  	TFT_SET_ADD(0,0,TFT_COLUMN_NUMBER-1,TFT_LINE_NUMBER-1);

	
	for(r=0;r<row;r++)
	{
		for(c=0;c<col;c++)
		{
			if(c==0 || r==0 || c == col-1 || r == row-1)
			{
				TFT_SEND_DATA(0xFF);
				TFT_SEND_DATA(0xFF);
			}else{
				TFT_SEND_DATA(0x00);
				TFT_SEND_DATA(0x00);
			}
			//delay(50);
		}
	}
}

void TFT_Page_net()
{
	int col = TFT_COLUMN_NUMBER;
	int row = TFT_LINE_NUMBER;
	
	int c, r;

  TFT_SET_ADD(0,0,TFT_COLUMN_NUMBER-1,TFT_LINE_NUMBER-1);
	
	
	for(c=0;c<col;c++)
	{
		for(r=0;r<row;r++)
		{
			if(r%2 == 0)
			{
				TFT_SEND_DATA(0xFF);
				TFT_SEND_DATA(0xFF);
			}else{
				TFT_SEND_DATA(0x00);
				TFT_SEND_DATA(0x00);
			}
		}
	}
}	

void TFT_Page_cell()
{
	int col = TFT_COLUMN_NUMBER;
	int row = TFT_LINE_NUMBER;
	
	int c = 0;
	int r = 0;

	int c2 = 0;
	int r2 = 0;

	int c3 = 0;
	int r3 = 0;

	TFT_SET_ADD(0,0,TFT_COLUMN_NUMBER-1,TFT_LINE_NUMBER-1);

	for(c=0;c<col;c++)
	{
		for(r=0;r<row;r++)
		{
			c2 = (int)(c/20);
			r2 = (int)(r/20);
			c3 = c2 % 2;
			r3 = r2 % 2;

			if(c3 == r3){
				TFT_SEND_DATA(0xFF);
				TFT_SEND_DATA(0xFF);
			}else{
				TFT_SEND_DATA(0x00);
				TFT_SEND_DATA(0x00);
			}			
		}
	}
}
	
void TFT_SET_ADD2(unsigned short int X,unsigned short int Y,unsigned short int X_END,unsigned short int Y_END)
{	
	TFT_SEND_CMD(0x2A);     //窗口地址横向                   
    TFT_SEND_DATA(X>>8);     
    TFT_SEND_DATA(X);//start column
	TFT_SEND_DATA(X_END>>8);     
    TFT_SEND_DATA(X_END);//start column
	TFT_SEND_CMD(0x2B);     //窗口地址纵向                   
    TFT_SEND_DATA(Y>>8);     
    TFT_SEND_DATA(Y);		//start row
    TFT_SEND_DATA(Y_END>>8);     
    TFT_SEND_DATA(Y_END);		//start row
    TFT_SEND_CMD(0x2C);     //写入数据   
}

void TEST_A(unsigned int color)
{
    unsigned long Line,column;
    TFT_SET_ADD2(0,0,100,150);
    for(Line=0;Line<150;Line++)             //Line loop
    { 
        
    for(column=0;column<100;column++)	//column loop
        {
            TFT_SEND_DATA(color>>8);
            TFT_SEND_DATA(color);
        }
    }
}
unsigned char picture_tab[128*128]={
// /*------------------------------------------------------------------------------
// ;  源文件 / 文字 : C:\Documents and Settings\Administrator\桌面\新建文件夹 (2)\logo.bmp字模
// ;  宽×高（像素）: 128×128
// ------------------------------------------------------------------------------*/
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0X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					TFT_SEND_DATA(Bcolor>>8);
					TFT_SEND_DATA(Bcolor);
				}
				else 
				{
					TFT_SEND_DATA(Ccolor>>8);
					TFT_SEND_DATA(Ccolor);
				}
				x <<=1;
			}
		}
	}			
}